Component({
    properties: {
        name: {
            type: null
        },
        datas: {
            type: null
        },
        power: {
            type: null
        }
    },
    data: {
        nowtime: "",
        timeOver: "",
        lastTime: 0,
        ispower: ""
    },
    lifetimes: {
        attached: function() {},
        moved: function() {},
        detached: function() {
            clearInterval(this.data.timeOver);
        }
    },
    observers: {
        datas: function(t) {
            var e = this;
            if (console.log(t), 3 == t.project_shell_type) {
                console.log("".concat(t.lock_update_at, "000"));
                var a = Number("".concat(t.lock_update_at, "000")), o = e.formatDate(a);
                this.data.timeOver = setInterval(function() {
                    var t = new Date().getTime();
                    e._countDown(a, t);
                }, 1e3), e.setData({
                    nowtime: o
                }), console.log(o);
            }
        },
        power: function(t) {
            console.log(t);
            this.setData({
                ispower: t
            });
        }
    },
    methods: {
        joinCart: function(t) {
            var e = t.currentTarget.dataset.item.id;
            this.triggerEvent("addProject", e);
        },
        editProject: function(t) {
            console.log(t);
            var e = t.currentTarget.dataset.id;
            this.triggerEvent("delId", e);
        },
        delProject: function() {
            var t = e.currentTarget.dataset.id;
            console.log(t), this.triggerEvent("editProject", t);
        },
        examine: function(t) {
            console.log(t);
            var e = t.currentTarget.dataset.id;
            wx.navigateTo({
                url: "/packageE/member/collage/tacit_detproject/tacit_detproject?id=" + e
            });
        },
        _countDown: function(t, e) {
            if (t - e < 0) return clearInterval(this.data.timeOver), void this.setData({
                lastTime: 0
            });
            var a = (t - e) / 1e3, o = parseInt(a / 86400), n = parseInt(a % 86400 / 3600), r = parseInt(a % 86400 % 3600 / 60), i = parseInt(a % 86400 % 3600 % 60), c = {
                day: this._timeFormat(o),
                hou: this._timeFormat(n),
                min: this._timeFormat(r),
                sec: this._timeFormat(i)
            };
            this.setData({
                lastTime: "".concat(c.day, "天").concat(c.hou, "时").concat(c.min, "分").concat(c.sec, "秒")
            });
        },
        _timeFormat: function(t) {
            return t < 10 ? "0" + t : t;
        },
        formatDate: function(t) {
            return console.log(t), t.getFullYear() + "-" + ((t.getMonth() + 1 < 10 ? "0" + (t.getMonth() + 1) : t.getMonth() + 1) + "-") + (t.getDate() < 10 ? "0" + t.getDate() : t.getDate()) + " " + ((t.getHours() < 10 ? "0" + t.getHours() : t.getHours()) + ":") + ((t.getMinutes() < 10 ? "0" + t.getMinutes() : t.getMinutes()) + ":") + (t.getSeconds() < 10 ? "0" + t.getSeconds() : t.getSeconds());
        }
    }
});